﻿using System;
using libEngineAI;
using libEngineAI.Interfaces;
using System.Collections.Generic;

namespace libGameCheckers
{
	public class Piece : IPiece
	{
		#region IPiece implementation

		public TeamEnum Team { get; set; }

		public Coordinate Coordinates { get; set; }

		public int Value { get; set; }

		public bool IsDeath { get; set; }

		#endregion

		public override bool Equals(object obj)
		{
			IPiece p = obj as IPiece;

			return ( p.IsDeath == IsDeath && p.Coordinates.Equals( Coordinates ) && Team == p.Team && p.Value == Value );
		}

		public override int GetHashCode()
		{
			int isdeath = IsDeath ? 0 : 1;

			return ( Coordinates.x ^ Coordinates.y ^ isdeath );
		}
	}
}

